package com.sp2.dev.apachecommons;

import org.apache.commons.lang.builder.*;

/**
 * Created by IntelliJ IDEA.
 * User: zhimingli
 * Date: 14-2-17
 * Time: 上午11:45
 * To change this template use File | Settings | File Templates.
 */
public class Usercommon {
    private String name;

    private int age;

    public Usercommon(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    //简化tostring写法
    @Override
    public String toString() {
        return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
    }


    //简化hashcode写法
    @Override
    public int hashCode() {
        return HashCodeBuilder.reflectionHashCode(this);
    }

    //简化equals写法
    @Override
    public boolean equals(Object obj) {
        return EqualsBuilder.reflectionEquals(this,obj);
    }


}
